#include "CVistaThreadPool.hpp"
#include "CLock.hpp"
#include "CTimer.hpp"
#include <stdio.h>


VOID Work1(int context)
{
    Sleep(100);
    printf("%d Thread id %d\n",context,GetCurrentThreadId());
    Sleep(100);
}



VOID QueueWork1(CVistaThreadPool *pPool)
{
    static CWorkCallBack<int> callback(Work1,0);
    for (int i=0;i<5;i++)
    {
        pPool->QueueWorkerItem<int>(&callback);
    }
}

VOID ThreadPoolTest()
{
    CVistaThreadPool *pPool=CVistaThreadPool::CreateThreadPool(2,2);
    QueueWork1(pPool);
}

VOID TimerTest()
{
    static CWorkCallBack<int> timerCallback(Work1,0);
    CTimer timer(&timerCallback,1000,1000);
    timer.Start();
    Sleep(10000);
    timer.Stop();
    
}

int main(int argc,char** argv)
{
    //ThreadPoolTest();
    TimerTest();
    char buf[255];
    scanf_s("%s",buf);
    return 0;
}